package com.tjetc.utils;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisDb {
    private static JedisPool jedisPool;

    static {
        //1.创建连接池的配置对象
        JedisPoolConfig config = new JedisPoolConfig();
        //2.设置配置参数
        config.setMaxIdle(100);
        config.setMaxIdle(30);
        //3.创建连接池对象
        jedisPool = new JedisPool(config, "localhost", 6379);
    }

    public static Jedis jedis(){
        return jedisPool.getResource();
    }



}
